package com.woniu.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniu.entity.PageData;
import com.woniu.entity.vo.UserScoreVO;
import com.woniu.entity.vo.UserTrainingVO;
import com.woniu.mapper.UserScoreMapper;
import com.woniu.mapper.UserTrainingMapper;
import com.woniu.pojo.UserScore;
import com.woniu.pojo.UserTraining;
import com.woniu.service.RankUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class RankUserServiceImpl extends ServiceImpl<UserScoreMapper, UserScore> implements RankUserService {

    @Autowired
    private UserScoreMapper userScoreMapper;

    @Autowired
    private RedisTemplate redisTemplate;

    @Override
    public PageData selectTop(Integer currentPage, Integer pageSize, UserScoreVO userScoreVO) {
        IPage<UserScoreVO> page = new Page<>(currentPage, pageSize);
        IPage<UserScoreVO> select = userScoreMapper.selectTop(page, userScoreVO);
        PageData pageData = new PageData(select.getTotal(), select.getRecords());
        return pageData;
    }

    @Override
    public List<UserScoreVO> selectAll() {
        List<UserScoreVO> userScore1 = userScoreMapper.selectAll();
        return userScore1;
    }

    @Override
    public List<UserScoreVO> selectMonth() {
        List<UserScoreVO> userScore2 = userScoreMapper.selectMonth();
        return userScore2;
    }


}
